<template>
  <div class="list-table">
    <!--    <el-form ref="queryForm" :model="queryParams" :inline="true">-->
    <!--      <el-form-item>-->
    <!--        <el-button type="primary" icon="el-icon-search" size="mini" @click="queryHandle">{{ $t('搜索') }}</el-button>-->
    <!--        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">{{ $t('重置') }}</el-button>-->
    <!--      </el-form-item>-->
    <!--    </el-form>-->
    <el-row>
      <el-col :span="24">
        <el-table v-loading="loading" :data="dealBaseList" border tooltip-effect="darkTable">
          <el-table-column :label="$t('序号')" type="index" align="center" show-overflow-tooltip width="50">
            <template slot-scope="scope">
              {{ (queryParams.pageNum - 1) * queryParams.pageSize + scope.$index + 1 }}
            </template>
          </el-table-column>
          <el-table-column align="center" prop="dealName" :label="$t('项目名称')" :show-overflow-tooltip="true" min-width="180">
            <template slot-scope="scope">
              <router-link
                target="_blank"
                :to="{path:'/deal/home/dealBaseHome',query:{id:scope.row.dealId,companyId:scope.row.companyId}}"
                class="link_a"
              >{{ scope.row.dealName }}</router-link>
            </template>
          </el-table-column>
          <el-table-column :label="$t('已收款租金') + $t('金额单位')" align="center" prop="paidPaymentAmount" min-width="180" :show-overflow-tooltip="true">
            <template slot-scope="scope">
              <span>{{ moneyFormat(scope.row.paidPaymentAmount, 'w') }}</span>
            </template>
          </el-table-column>
          <el-table-column :label="$t('未收款租金') + $t('金额单位')" align="center" prop="noPaymentAmount" min-width="180" :show-overflow-tooltip="true">
            <template slot-scope="scope">
              <span>{{ moneyFormat(scope.row.noPaymentAmount, 'w') }}</span>
            </template>
          </el-table-column>
          <el-table-column :label="$t('二级行业')" align="center" prop="industrySecond" min-width="180" :show-overflow-tooltip="true" />
        </el-table>
      </el-col>
    </el-row>

    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />
  </div>
</template>

<script>
  import { findByLeasingIndustryFirst } from '@/api/base/deal/dealBase'
  export default {
    components: {
    },
    data() {
      return {
        // 遮罩层
        loading: true,
        // 总条数
        total: 0,
        // 租赁项目表格数据
        dealBaseList: [],
        // 是否显示弹出层
        formOpen: false,
        // 列表查询参数
        queryParams: {
          industrySecondId: this.$route.params.type,
          dealStatus: undefined,
          dealName: undefined,
          // 应为融资租赁类型
          dealType: 'lease',
          pageNum: 1,
          pageSize: 10
        },
        // 饼状图查询参数
        queryParams2: {
          dealType: 'lease',
          dealStatus: undefined
        }
      }
    },
    created() {
      this.getList()
    },
    methods: {
      /** 查询租赁项目-行业细分统计列表 */
      getList() {
        this.loading = true
        findByLeasingIndustryFirst(this.queryParams).then(response => {
          this.dealBaseList = response.rows
          this.total = response.total
          this.loading = false
        }).catch(() => {
          this.loading = false
        })
      },
      // 表单重置
      reset() {
        this.form = {
          id: undefined,
          dealName: undefined,
          delFlag: undefined,
          createBy: undefined,
          createTime: undefined,
          updateBy: undefined,
          updateTime: undefined
        }
        this.resetForm('form')
      },
      /** 搜索按钮操作 */
      queryHandle() {
        this.queryParams.pageNum = 1
        this.getList()
      },
      /** 重置按钮操作 */
      resetQuery() {
        this.resetForm('queryForm')
        this.queryHandle()
      }
    }
  }
</script>
